//
//  HP_HotTitleTableViewCell.m
//  JinFuThree
//
//  Created by 爱尚 on 2018/8/31.
//  Copyright © 2018年 毛韶谦. All rights reserved.
//

#import "HP_HotTitleTableViewCell.h"
#import "HP_LoanListViewController.h"
#import "HomePageViewController.h"

@implementation HP_HotTitleTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = ListMaoBackgroundColor;
        [self initialize];
    }
    return self;
}

-(void)initialize{
    
    _titleLabel = [[UILabel alloc]init];
    _titleLabel.text = @"热门贷款";
    _titleLabel.font = UIFontBoldCustom(14);
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    _titleLabel.textColor = ThemeMaoBlackColor;
    [self addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.centerY.mas_equalTo(self);
        make.height.mas_offset(@15);
        make.width.mas_offset(@60);
    }];
    
    UIView *line1 = [[UIView alloc]init];
    line1.backgroundColor = HexColor(0x979797);
    [self addSubview:line1];
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.titleLabel);
        make.height.mas_offset(@1);
        make.width.mas_offset(@22);
        make.right.mas_equalTo(self.titleLabel.mas_left).offset(-5);
    }];
    
    UIView *line2 = [[UIView alloc]init];
    line2.backgroundColor = HexColor(0x979797);
    [self addSubview:line2];
    [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.width.mas_equalTo(line1);
        make.centerY.mas_equalTo(line1);
        make.left.mas_equalTo(self.titleLabel.mas_right).offset(5);
    }];
    
    _moreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [_moreBtn setTitle:@"更多>" forState:UIControlStateNormal];
    _moreBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [_moreBtn setTitleColor:ThemeMaoBackgroundColor forState:UIControlStateNormal];
    [_moreBtn addTarget:self action:@selector(moreBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_moreBtn];
    [_moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.mas_right).offset(-12);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.height.mas_offset(@14);
    }];
    
}

-(void)moreBtnAction{
    
    if ([self.delegate respondsToSelector:@selector(moreBtnAction)]) {
        [self.delegate moreBtnAction];
    }
   
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
